<template>
  <div>
<todo-header />
<todo-main :arr="list" />
<todo-footer/>
  </div>
</template>

<script>
import TodoFooter from './components/TodoFooter.vue'
import TodoHeader from './components/TodoHeader.vue'
import TodoMain from './components/TodoMain.vue'
import axios from 'axios'
axios.defaults.baseURL = 'http://liufusong.top:3001'
export default {
  components: { TodoHeader, TodoMain, TodoFooter },
  data () {
    return {
      list: []

    }
  },

  created () {
    this.getData()
  },
  updated () {
    this.getData()
  },

  methods: {
    async  getData () {
      const res = await axios({
        url: '/list',
        method: 'GET'
      })

      this.list = res.data
      // console.log(this.list)
    }
  }
}
</script>

<style scoped lang='less'>

</style>
